package com.haha.Services.impls;

import com.haha.Beans.Media;
import com.haha.Mappers.MediaMapper;
import com.haha.Services.IMediaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MediaService implements IMediaService {

    @Autowired
    private MediaMapper mediaMapper;
    @Override
    public List<Media> getAllMedia() {
        return this.mediaMapper.getAllMedia();
    }

    @Override
    public Integer getMediaCount() {
        return this.mediaMapper.getAllMediaCount();
    }

    @Override
    public Media selectMediaById(Integer id) {
        return this.mediaMapper.selectById(id);
    }

    @Override
    public Integer insertMedia(Media record) {
        return this.mediaMapper.insertMedia(record);
    }

    @Override
    public Integer deleteMedia(String id) {
        return this.mediaMapper.deleteMedia(id);
    }

    @Override
    public Media updateMedia(String  id, Media record) {
        return this.mediaMapper.updateMedia(id, record) >  0 ? record : null;
    }
}
